package com.mario.nanjing.ai.controller;

import cn.hutool.core.date.DateUtil;
import com.mario.nanjing.ai.service.FunctionAssistant;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author MarioZzz
 * @create 2025-08-05 9:43
 */
@RestController
@Slf4j
public class ChatFunctionCallingController {
    @Resource(name = "functionAssistantLow")
    private FunctionAssistant functionAssistantLow;

    @Resource(name = "functionAssistantHigh")
    private FunctionAssistant functionAssistantHigh;


    //  http://localhost:9011/chatfunction/test1
    @GetMapping(value = "/chatfunction/test1")
    public String test1() {
        //大模型会将用户输入的内容，总结出关键字，作为执行参数填写在执行模版上
        //执行函数时，会将模版传给这个函数
        String chat = functionAssistantLow.chat("开张发票,公司：XXXXX科技有限公司 税号：XXX-0527 金额：1668.12");

        System.out.println(chat);

        return "success : " + DateUtil.now() + "\t" + chat;
    }

    @GetMapping(value = "/chatfunction/test2")
    public String test2() {
        String chat = functionAssistantHigh.chat("开张发票,公司：XXXXX科技有限公司 税号：XXX-0527 金额：1668.12");

        System.out.println(chat);

        return "success : " + DateUtil.now() + "\t" + chat;
    }
}
